package com.wenhai.spring.bean.lifecycle;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

public class SingletonBean {
    private Long id;
    private String name;


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    @PostConstruct
    public void init() {
        System.out.println("我被初始化了");
        this.id = System.currentTimeMillis();
        this.name = "谢文海";
    }


    @PreDestroy
    public void destroy() {
        System.out.println("我被销毁了");
    }
}
